package 迷宫;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static int N = 110, n, x1, y1, x2, y2;
    static char[][] g = new char[N][N];
    static boolean[][] st = new boolean[N][N];
    static int[] dx = {-1, 1, 0, 0};
    static int[] dy = {0, 0, -1, 1};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while (T-- > 0) {
            n = in.nextInt();
            for (int i = 0; i < n; i++) {
                Arrays.fill(st[i], false);
            }
            for (int i = 0; i < n; i++) {
                g[i] = in.next().toCharArray();
            }
            x1 = in.nextInt();
            y1 = in.nextInt();
            x2 = in.nextInt();
            y2 = in.nextInt();
            if (dfs(x1, y1)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }

    private static boolean dfs(int x, int y) {
        if (g[x][y] == '#') {
            return false;
        }
        st[x][y] = true;
        if (x == x2 && y == y2) {
            return true;
        }
        for (int i = 0; i < 4; i++) {
            int a = x + dx[i];
            int b = y + dy[i];
            if (a < 0 || a >= n || b < 0 || b >= n) {
                continue;
            }
            if (st[a][b]) {
                continue;
            }
            if (g[a][b] != '.') {
                continue;
            }
            if (dfs(a, b)) {
                return true;
            }
        }
        return false;
    }
}
